class Date {
    private int day;
    private int month;
    private int year;
    private boolean isValid = true;
    
    public int getDay() {
        return day;
    }
    
    public int getMonth() {
        return month;
    }
    
    public int getYear() {
        return year;
    }
        
    public void parse(String date) {
        String[] dateParts = date.split("/");
        if (dateParts.length  != 3) {
           isValid = false;
           return;
        }
        
        if (!dateParts[0].matches("\\d+") || (Integer.parseInt(dateParts[0]) > 31)) {
            isValid = false;
        } else if (!dateParts[1].matches("\\d+") || (Integer.parseInt(dateParts[1]) > 12)) {
            isValid = false;
        } else if (!dateParts[2].matches("\\d+")) {
            isValid = false;
        }
        day = Integer.parseInt(dateParts[0]);
        month = Integer.parseInt(dateParts[1]);
        year = Integer.parseInt(dateParts[2]);
    }
    
    public boolean isValid() {
        return isValid;
    }    
}